package paquete;

public class ConjuntoArrBoolean implements ConjuntoTDA {

	boolean[] C = {false};
	int cant;
	
	public void agregar(int e) {
		if (C[e] == false){
			C[e] = true;
			cant++;
			}

	}


	public boolean conjuntoVacio() {
		return cant == 0;
	}


	public int elegir() {
		if (cant > 0){
			int i=0;
			while (C[i]==false)
			i++;

			return i;
			}
		else
			return 0;
	}


	public void inicializarConjunto() {
		C = new boolean[100];
		cant = 0;

	}


	public boolean pertenece(int e) {
		return (C[e] == true);
	}


	public void sacar(int e) {
		if (C[e] == true){
			C[e]= false;
			cant--;
			}

	}

}
